﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
    public partial class Reader : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var connection = new System.Data.SqlClient.SqlConnection();
            connection.ConnectionString = @"Data Source=.\Katmai;Initial Catalog=Test;Integrated Security=True";
            var sqlCommand = connection.CreateCommand();
            sqlCommand.CommandText = "SELECT * FROM Firma";

            connection.Open();
            var reader = sqlCommand.ExecuteReader();
            dgSkole.DataSource = reader;
            dgSkole.DataBind();
            connection.Close();


            //connection = new System.Data.SqlClient.SqlConnection();
            //connection.ConnectionString = @"Data Source=.\Katmai;Initial Catalog=Test;Integrated Security=True";
            //sqlCommand = connection.CreateCommand();
            sqlCommand.CommandText = "SELECT * FROM Skola";

            connection.Open();
            reader = sqlCommand.ExecuteReader();
            dgZaposleni.DataSource = reader;
            dgZaposleni.DataBind();
            connection.Close();
        }
    }
}